<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('患者基本信息列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <input type="hidden" id="diaId" name="diaId" th:value="${dia}">
                            <input type="hidden" id="admType" name="admType" th:value="${admType}">
                            <li>
                                <label>登记号：</label>
                                <input type="text" name="patNo"/>
                            </li>
                            <li>
                                <label>患者姓名：</label>
                                <input type="text" name="patName"/>
                            </li>
                            <li>
                                <label>身份证：</label>
                                <input type="text" name="patIdCard"/>
                            </li>
                            <!--
                            <li>
                                <label>复诊状态：</label>
                                <select name="flag" >
                                    <option value="N">未复诊</option>
                                    <option value="Y">已复诊</option>
                                    <option value="">所有</option>
                                </select>
                            </li>
                            -->
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
                <a class="btn btn-success" onclick="addPat()" shiro:hasPermission="disease:patient:add">
                    <i class="fa fa-plus"></i> 添加
                </a>
                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="disease:patient:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="disease:patient:export">
                    <i class="fa fa-download"></i> 导出
                </a>
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('disease:patient:edit')}]];
        var removeFlag = [[${@permission.hasPermi('disease:patient:remove')}]];
        var sys_user_sex = [[${@dict.getType('sys_user_sex')}]];
        var pat_marriage = [[${@dict.getType('pat_marriage')}]];
        var pat_career = [[${@dict.getType('pat_career')}]];
        var pat_nation = [[${@dict.getType('pat_nation')}]];
        var pat_domicile = [[${@dict.getType('pat_domicile')}]];
        var pat_education = [[${@dict.getType('pat_education')}]];
        var pat_insu = [[${@dict.getType('pat_insu')}]];
        var pat_dia = [[${@dict.getType('pat_dia')}]];
        var prefix = ctx + "disease/patient";

        var diaId = $("#diaId").val();
        var admType = $("#admType").val();
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add/" + diaId+ "/" + admType,
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "患者基本信息",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '',
                    visible: false
                },
                {
                    field: 'patiDiaId',
                    title: '疾病',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pat_dia, value);
                    }
                },
                {
                    field: 'patNo',
                    title: '登记号'
                },
                {
                    field: 'patName',
                    title: '患者姓名'
                },
                {
                    field: 'patSex',
                    title: '性别',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(sys_user_sex, value);
                    }
                },
                {
                    field: 'patBirth',
                    title: '生日',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patCareer',
                    title: '职业',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pat_career, value);
                    }
                },
                {
                    field: 'patMarriage',
                    title: '婚姻',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pat_marriage, value);
                    }
                },
                {
                    field: 'patNation',
                    title: '民族',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pat_nation, value);
                    }
                },
                {
                    field: 'patDomicile',
                    title: '户籍',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pat_domicile, value);
                    }
                },
                {
                    field: 'patEducation',
                    title: '学历',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pat_education, value);
                    }
                },
                {
                    field: 'patInsu',
                    title: '医保类型',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(pat_insu, value);
                    }
                },
                {
                    field: 'patHeight',
                    title: '身高',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patWeight',
                    title: '体重',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patAddress',
                    title: '地址',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patIdCard',
                    title: '身份证',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patTel',
                    title: '电话',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patContact',
                    title: '联系人',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patContactTel',
                    title: '联系人电话',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patDiagnosis',
                    title: '诊断',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patChiefComplaint',
                    title: '主诉',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    field: 'patDoctor',
                    title: '首诊医师',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value,2);
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function edit(patId){
            var diaId = $("#diaId").val();
            var url = prefix + "/edit/" + patId + "/" + diaId ;
            $.modal.openTab("编辑", url);
        }

        function addPat(){
            $.operate.add();
        }
    </script>
</body>
</html>